package com.itheima.d6_tcp3;

import javax.imageio.IIOException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

public class ClientThread implements Runnable{
    private Socket socket;
    public ClientThread(Socket socket){
        this.socket=socket;
    }
    @Override
    public void run() {
        //读取内容
        //获取输入流
        try{
            BufferedReader br=new BufferedReader(new InputStreamReader(socket.getInputStream()));
            while(true){
                String content= br.readLine();//阻塞
                System.out.println("其他人： "+content);
            }
        }catch (IOException e){
            throw new RuntimeException(e);
        }
    }
}
